package org.rednebula.framework.core.context;

import java.io.Serializable;

import org.rednebula.framework.core.BasicContext;
import org.rednebula.framework.core.utils.Struts2Utils;


import com.opensymphony.xwork2.util.ValueStack;

public class ValueStackContext extends BasicContext implements Serializable {

	public ValueStackContext() {
		super();
		this.setName(VALUESTACKCONTEXT);
	}

	public void close() {

	}
    
	public ValueStack getValueStack(){
		return Struts2Utils.getValueStack();
	}
	public <T> T get(String key) {
		if(this.isSelf(key))return (T)this.getValueStack();
		return (T)getValueStack().findValue(key);
	}

	public <T> T get(Class<T> type) {
		return (T)getValueStack().findValue(type.getName());
	}

	public boolean has(String name) {
		return true;
	}

}
